﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="ApprovalFeature" name="Approval Feature">
	<ConfigurationClasses>
		<Class name="sysObjs-Approval" type="Approval.ApprovalConfigPartner,ScsCore" />
	</ConfigurationClasses>
	<Dependencies>
		<Dependency type="binary">Approval.dll</Dependency>
		<Dependency type="feature">BaseFrameworkFeature.xml</Dependency>
	</Dependencies>
	<BusinessRules>
		<BusinessRule name="getApprovalDataState" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>  
		<BusinessRule name="executeApprovalAction" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="createApprovalSet" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="addApprover" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="removeApprover" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		
		<BusinessRule name="getParentFieldName" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="checkForCompanyApproval" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getApprovalSet" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getBizObjApprovers" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getApprovers" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getApproverList" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="hasVoted" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="isApproval" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getApprovalData" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="setupApprovalData" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getNextApprover" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getApprovalDetails" security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>

		<BusinessRule name="getApprovalHistoryView"  security="disabled">
			<Option value="$ApprovalRemoteTier$">
				<RemoteRule url="$ApprovalRemoteTier$" />
				<LocalClass name="Approval.BizRules,ScsCore" />
			</Option>
		</BusinessRule>

		<BusinessRule name="getApprovalTemplate"  security="disabled">
				<LocalClass name="Approval.TemplateBizRule,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getApprovalSetTemplate"  security="disabled">
			<LocalClass name="Approval.TemplateBizRule,ScsCore" />
		</BusinessRule>
	</BusinessRules>
	
	<BusinessObjects>
		<BusinessObject type="ApprovalRule" >
			<Field name="ruleName" type="String" />
			<Field name="factoryName" type="String" />
			<Field name="setCall" type="Boolean" />
			<Field name="decorator" type="Object"><NULL/></Field>
		</BusinessObject>
		<BusinessObject type="ApprovalInfo" key="id">
			<Field name="id" type="String" />
			<Field name="parentFieldId" type ="String" />
			<Field name="set" type="String" />
			<Field name="master" type="String" />
			<Field name="subs" type="String" />
			<Field name="getListRule" type="String" />
			<Field name="getAddRule" type="String" />
			<Field name="originalAction" type="String" />
			<Field name="rules" type="List(ApprovalRule)" />
		</BusinessObject>
		<BusinessObject type="ApprovalSet" key="id,objectType" >
			<Field name="id" type="Guid" />	  
			<Field name="objectType" type="String" />
			<Field name="approvers" type="List(Approver)" />
			<Field name="saveHistory" type="Boolean" />
			<Field name="moveToParentTree" type="Boolean" />
			<Method name="state" language="jscript.NET"><![CDATA[
				var state = self.getItem("approvers")
				if(state.numElements > 0)
					return "Approval Enabled";
				else
					return "Approver Not Set";
			]]>
			</Method>
		</BusinessObject>
		<BusinessObject type="Approver" key="id,setId" extends="User">
			<Field name="setId" type="Guid" ><NULL/></Field>
			<Field name="typeName" type="String" />
			<Field name="showForApprovalOnly" type="Boolean"/>
			<Field name="reviewOnly" type="Boolean" />
			<Field name="canContribute" type="Boolean" />
			<Field name="rank" type="Integer" />
			<Field name="notifyForApproval" type="Boolean" />
		</BusinessObject>
		<BusinessObject type="ApprovalData" key="id">
			<Field name="id" type="Guid" />
			<Field name="approvalSet" type="ApprovalSet" />
			<Field name="state" type="Integer" >0</Field>
			<Field name="nextApprover" type="Guid" />
			<Field name="originalAction" type="String" />
			<Field name="lastUpdateBy" type="User" />
			<Field name="createdById" type="Guid" />
			<Field name="selectedObjectDataId" type="Guid" />
			<Field name="rawbizObj" type="String" />
			<Field name="approvalDataChange" type="List(ApprovalDataChange)" />
			<Method name="nextApproverName" language="jscript.NET">
				<![CDATA[
				var list = self.getItem("approvalSet.approvers");
				var bizobj = null;
				if(list.numElements > 0)
				{
					bizobj = list.search("id",self.getItem("nextApprover"));
					if(bizobj!=null)
						return bizobj.getItem("userName").ToString() ;
				}
				return "NONE";
			]]>
			</Method>
			<Method name="stateAltText" language="jscript.NET">
					<![CDATA[
				var state = self.getItem("state").ToString();
				if("1".Equals(state))
					return "Live with history";
				else if("2".Equals(state))
					return "Denied";
				else if("4".Equals(state))
					return "Live no history";
				else
					return "";
				return "Waiting for approval";
			]]>
			</Method>
		</BusinessObject>
		<BusinessObject type="ApprovalDataChange" key="id">
			<Field name="id" type="Guid" />
			<Field name="createdBy" type="Approver" />
			<Field name="approvalDataId" type="Guid" />
			<Field name="actionType" type="String" />
			<Field name="bizObjData" type="String" />
		</BusinessObject>
		
		
		<BusinessObject injects="Company">
			<Field name="hasApproval" type="Boolean" />
			<Field name="approvalState" type="Integer" >0</Field>
		</BusinessObject>
		<BusinessObject injects="UserGroup">
			<Field name="isApproverGroup" type="Boolean" />
		</BusinessObject>
		<BusinessObject injects="User">
			<Field name="isApprover" type="Boolean" />
		</BusinessObject>
	</BusinessObjects>
	<ClassFactory id="ApprovalDecorators">
		<Class type="Approval.Decorators.GetListActionRuleManager,ScsCore" name="GetList" />
		<Class type="Approval.Decorators.GetDetailsActionRuleManager,ScsCore" name="GetDetails" />
		<Class type="Approval.Decorators.AddActionRuleManager,ScsCore" name="AddBizObj" />
		<Class type="Approval.Decorators.UpdateActionRuleManager,ScsCore" name="UpdateBizObj" />
		<Class type="Approval.Decorators.DeleteActionRuleManager,ScsCore" name="DeleteBizObj" />
	</ClassFactory>
	<!--<ApplicationData>
		<Entry id="filterSortOptions.approvalData" type="IBizObj.FilterSortGroupConfig">
			<FilterSortGroup id="approvalData">
				<FilterFieldOptions>
					<FilterFieldOption name="Status" value="state" defaultEditor="combo(getApprovalDataState())">
						<CriteriaOptions>
							<Criteria name="=" value="=" />
						</CriteriaOptions>
					</FilterFieldOption>
				</FilterFieldOptions>
			</FilterSortGroup>
		</Entry>
	</ApplicationData>-->
</Feature>
